package com.bdqn.desiremall.command;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.bdqn.desiremall.entity.Mall_Goods;
import com.bdqn.desiremall.serivce.goods.GoodsSerivce;
import com.bdqn.desiremall.serivce.goods.GoodsSerivceImpl;
import com.mvc.command.ICommand;

public class GoodsCommand implements ICommand {
	GoodsSerivce goodsSerivce=new GoodsSerivceImpl();
	//所有查看商品
	public void SelectGoods(HttpServletRequest request,HttpServletResponse response)
	{
		request.setAttribute("goodsList", goodsSerivce.goodsView(null));
		try {
			request.getRequestDispatcher("Index.jsp").forward(request, response);
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	//查看类别
	public void GoodsCategoryView(HttpServletRequest request,HttpServletResponse response)
	{
		request.setAttribute("goodeCategoryList", goodsSerivce.findGoodsCategoryView(1));
		try {
			request.getRequestDispatcher("Index.jsp").forward(request, response);
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
}
